--[[
FilePath: \Lua\View\UISoloBattle\UISoloShop.lua
1v1神秘商店
--]]

require 'View/UIBase/UIBase'

UISoloShop = UIBase.New(PanelNames.UISoloShop)
local _M = UISoloShop

_M.hasInit = false

function _M.Init(func)
    UIBase.Init(_M, func)
end

function _M:OnCreate()
    if not _M.hasInit then
        self.btnClose = self:GetChild("Btn_Back");
        self.title = self:GetChild("titleBg"):GetChild("title");
        self.heroDraw = self:GetChild("herodraw");
        self.listShop = self:GetChild("List_Shop");

        self.listShop.itemRenderer = self.refreshItem;
        self.listShop:SetVirtual();

        _M.hasInit = true

        self:addEvent()
    end
    self:initView();
end

function _M:addEvent()
    self.btnClose.onClick:Add(self.onClosePanel,self);
end

function _M:removeEvent()
    self.btnClose.onClick:Remove(self.onClosePanel);
end

function _M:initView()
    self.title.text = getLanguage("神秘商人");
end

function _M.refreshItem(index, itemObj)
    local name = itemObj:GetChild("Text_itemName");
    local btnItem = itemObj:GetChild("Btn_item");
    local sum = itemObj:GetChild("sum");
end

-- 显示
function _M:OnEnable()

end

function _M:onClosePanel()
    closeUI(PanelNames.UISoloShop);
end

-- 隐藏
function _M:OnDisable()

end

-- 卸载
function _M:OnDestroy()
    self:removeEvent();
    self.hasInit = false
end

return _M;